﻿@page
@model PracticalAspNetCore.Pages.IndexRazorPagesModel
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

<h1>Razor Pages Implementation</h1>
<p>Add your entry to guestbook.</p>
<form method="post">
    <table class="table">
        <thead>
        <tr>
            <th>Id</th>
            <th>Email</th>
            <th>Content</th>
            <th>Likes</th>
        </tr>
        </thead>
        <tbody>
        @foreach (var entry in Model.Entries)
        {
            <tr>
                <td>@entry.Id</td>
                <td>@entry.Email</td>
                <td>@entry.Content</td>
                <td>@entry.Likes</td>
                <td>
                    <button type="submit" asp-page-handler="like" 
                            asp-route-id="@entry.Id">like</button>
                    <a asp-page="./Edit" asp-route-id="@entry.Id">edit</a>
                </td>
            </tr>
        }
        </tbody>
    </table>
    <a asp-page="./Create">Create</a>
</form>

<p>Go back to <a href="/Index">Index</a></p>
